package com.patternsbox.behavioral.iterator;

import java.util.ArrayList;
import java.util.List;

class ConcreteAggregate implements Aggregate {
	private List<Object> items = new ArrayList<Object>();

	public void add(Object item) {
		items.add(item);
	}

	public Iterator createIterator() {
		return new ConcreteIterator(this);
	}

	public int count() {
		return items.size();
	}

	public Object get(int index) {
		if(index < items.size())
			return items.get(index);
		return null;
	}

}
